#ifndef P_UNLIT_MATERIAL_COMPONENT_H
#define P_UNLIT_MATERIAL_COMPONENT_H

#include "PMaterialComponent.h"

namespace Piccolo
{
    enum EUnlitMaterialTexture
    {
        UNLIT_MAT_BASE_COLOR_0,
        UNLIT_MAT_BASE_COLOR_1
    };

    struct FrameUBO
    {
        glm::mat4 projMatrix{ 1.f };
        glm::mat4 viewMatrix{ 1.f };
        alignas(8) glm::ivec2 resolution;
        alignas(4) uint32_t frameId;
        alignas(4) float time;
    };

    struct UnlitMaterialUBO
    {
        alignas(16) glm::vec3 baseColor0;
        alignas(16) glm::vec3 baseColor1;
        alignas(4) float mixValue;
        alignas(16) TextureParam textureParam0;
        alignas(16) TextureParam textureParam1;
    };

    class PUnlitMaterial : public PMaterial
    {
    public:
        const UnlitMaterialUBO& GetMaterialUBO() const { return unlitMaterialUbo; }
        const glm::vec3& GetBaseColor0() const { return unlitMaterialUbo.baseColor0; }
        const glm::vec3& GetBaseColor1() const { return unlitMaterialUbo.baseColor1; }
        float GetMixValue() const { return unlitMaterialUbo.mixValue; }

        void SetBaseColor0(const glm::vec3& color)
        {
            unlitMaterialUbo.baseColor0 = color;
            bShouldFlushParams = true;
        }

        void SetBaseColor1(const glm::vec3& color)
        {
            unlitMaterialUbo.baseColor1 = color;
            bShouldFlushParams = true;
        }

        void SetMixValue(float mixValue)
        {
            unlitMaterialUbo.mixValue = mixValue;
            bShouldFlushParams = true;
        }

    private:
        UnlitMaterialUBO unlitMaterialUbo;
    };

    class PUnlitMaterialComponent : public PMaterialComponent<PUnlitMaterial>
    {

    };
}

#endif